const mongoose = require("mongoose"); // 导入moogose数据库
// 创建英雄模型,两个字段
const schema = new mongoose.Schema({
  name: { type: String },
  icon: { type: String },
  title: { type: String },
  types: [{ type: mongoose.Schema.Types.ObjectId, ref: "Category" }],
  scores: {
    difficult: { type: Number }, // 难度
    skill: { type: Number }, // 技能
    attack: { type: Number }, // 攻击
    survive: { type: Number }, // 生存
  },
  // 技能
  skills: [
    {
      icon: { type: String },
      name: { type: String },
      description: { type: String },
      tips: { type: String },
    },
  ],
  // 顺风装备
  items1: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: "Equip",
    },
  ],
  // 逆风装备
  items2: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: "Equip",
    },
  ],
  usageTips: { type: String }, // 使用技巧
  battleTips: { type: String }, // 对战用技巧
  teamTips: { type: String }, // 团战技巧
  partners: [{ 
    hero: { type: mongoose.Schema.Types.ObjectId, ref: 'Hero'},
    description: { type: String }
   }] // 伙伴
});
// 导出数据模型
module.exports = mongoose.model("Hero", schema);
